The present invention relates generally to computer cache memory systems, and more particularly, to a cache memory that includes aspects of write-through and write-back caches.
Data may be stored and retrieved from some types of memory devices used in computer systems more rapidly than for other types of memory devices. For example, DRAM (dynamic random access memory) is relatively low in cost and has fast access. However, a disadvantage of DRAM is that is it is volatile and data stored in DRAM is lost when power is removed from the memory devices. Disk storage devices with magnetic, optical, or other types of rotating disk media are nonvolatile, have very low cost per byte of storage, and very high storage capacity. However, a disadvantage of disk storage devices is that they have relatively slow access for storing and retrieving data.
To reduce access times for disk storage devices, cache memory systems may be used to hold data that has been recently read or modified and may also hold data areas adjacent to recently read or modified data. The latency for cache memory devices is generally somewhere between latency for DRAM and latency for disk storage devices. The term latency refers to a time delay between initiation of a read request, to read requested data, or write request, to write requested date to storage, a memory device and the retrieval of data from or storage of data to the memory device. Relatively fast memory devices such as DRAM or flash memory may be used in cache memory systems. “Flash” memory is a type of nonvolatile memory device with faster access time than disk storage devices, but slower access time than DRAM memory devices. While flash memory devices have faster access time than disk storage devices, they are generally considered to be too expensive to be used for the entire memory space in a computer system. A combination of DRAM, cache memory, and disk storage may therefore be used to achieve a balance between system performance and system cost.
The difference in latency between disk storage devices and DRAM has increased over time. While the storage capacities of both DRAM and disk storage have increased and memory cost per byte has decreased over time, the ratio in a computer system of storage capacity implemented as cache memory to storage capacity implemented as disk storage has remained relatively small. As costs for flash memory decrease, it has become a viable consideration to use flash memory devices in cache memory applications, such as write-through caches and write-back caches.
In a write-through cache, data is written to the cache memory and to the disk storage device at about the same time. In a write-back cache, data to be saved is not immediately written to the disk storage device. Instead, data to be saved is written into the cache, the cache monitors which of its locations have been modified, and the modified cache locations are marked as “dirty data.” Dirty data is data that has not yet been written to a disk storage device. Data is copied from the write-back cache to a disk storage device when a data replacement algorithm determines the dirty data may be removed from the cache.